import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useMyInformationPinia = defineStore('useMyInformationPinia', () => {
  const myInformation = ref({
    id: null,
    username: '',
    nickname: '',
    email: '',
    user_pic: ''
  });

  const updateMyInformation = (newMyInformation) => {
    myInformation.value = {
      ...myInformation.value,
      ...newMyInformation
    };
    return myInformation.value;
  };

  return {
    myInformation,
    updateMyInformation
  };
}, {
  persist: true
})
